/*
 * @Author: Await
 * @Date: 2024-12-25 12:43:13
 * @LastEditors: Await
 * @LastEditTime: 2024-12-25 14:09:51
 * @Description: 请填写简介
 */
import { request } from '../request';

/** 获取字幕列表 */
export function fetchSubtitleList(params: Api.Subtitle.SubtitleQuery) {
    // 处理时间范围参数
    const { timeRange, ...rest } = params;
    const queryParams = {
        ...rest,
        startTime: timeRange?.[0] || undefined,
        endTime: timeRange?.[1] || undefined
    };
    return request<Api.ResponseModel<Api.Subtitle.SubtitleDto[]>>({
        url: '/Subtitles/TranslateListQuery',
        method: 'get',
        params: queryParams
    });
}

/** 添加字幕 */
export function addSubtitle(data: Api.Subtitle.SubtitleVo) {
    return request<number>({
        url: '/Subtitles/TranslateData',
        method: 'post',
        data
    });
}

/** 修改字幕 */
export function updateSubtitle(data: Api.Subtitle.SubtitleVo) {
    return request<number>({
        url: '/Subtitles/TranslateData',
        method: 'put',
        data
    });
}

/** 删除字幕 */
export function deleteSubtitle(id: string) {
    return request<number>({
        url: `/Subtitles/TranslateData/${id}`,
        method: 'delete'
    });
} 